<template>
  <div
    v-if="isVisiabled"
    class="overDiv"
  >
    <div
      v-if="isVisiabled"
      class="modelBox"
    >
      <el-form
        :inline="true"
        :model="formInline"
        class="demo-form-inline"
      >
        <div class="header">
          <div class="titles">
            提示
          </div>
          <div
            class="close"
            @click="hideModal"
          >
            <img
              src="../../assets/img/close.png"
              alt=""
            >
          </div>
        </div>
        <el-form
          :inline="true"
          :model="formInline"
          class="demo-form-inline"
        >
          <div class="body">
            <div class="tips">
              <div>
                <img
                  src="../../assets/img/success.png"
                  alt=""
                >
              </div>
              <div>
                <div class="success_text">
                  关注成功
                </div>
                <div
                  class="success_other"
                  @click="tocollect"
                >
                  查看我的关注
                </div>
              </div>
            </div>
            <el-form
              :inline="true"
              :model="formInline"
              class="form"
            >
              <el-form-item label="邮箱或手机号码:">
                <el-input
                  v-model="formInline.phone"
                  placeholder="审批人"
                />
              </el-form-item>
              <el-form-item label="当商品低于:">
                <el-input
                  v-model="formInline.price"
                  placeholder="审批人"
                />
              </el-form-item>
              <el-form-item label="通知您" />
            </el-form>
          </div>

          <div class="footer">
            <div
              class="btn"
              @click="onSubmit"
            >
              确定
            </div>
          </div>
        </el-form>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  props: ["visiable"],
  data() {
    return {
      formInline: {
        phone: "",
        price: "",
      },
      isVisiabled: false,
    };
  },
  watch: {
    visiable: function (val) {
      console.log(val);
      this.isVisiabled = val;
    },
  },
  methods: {
    //提交
    onSubmit() {
      console.log("submit!");
      console.log(this.formInline.phone);
      console.log(this.formInline.price);
      this.isVisiabled = false;
      this.$emit("changeVisiabled", false);
    },
    //隐藏
    hideModal() {
      this.isVisiabled = false;
      this.$emit("changeVisiabled", false);
    },
    tocollect() {
      if (localStorage.getItem("token")) {
        this.$router.push({
          path: "/person/collect",
        });
      } else {
        this.$message.error("请登录后操作！");
      }
    },
  },
};
</script>

<style scoped lang="scss">
.el-form-item {
  margin-bottom: 0;
}

.form {
  padding: 6.25rem 0 4.13rem;
  text-align: center;
}

.overDiv {
  position: fixed;
  height: 100%;
  width: 100%;
  left: 0;
  top: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
}

.modelBox {
  position: absolute;
  height: 26.56rem;
  width: 50.38rem;
  padding: 1.25rem;
  left: 50%;
  margin-left: -26.44rem;
  top: 50%;
  margin-top: -14.53rem;
  background: rgba(255, 255, 255, 1);
  z-index: 1001;

  .header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;

    .titles {
      font-size: 1.13rem;
      color: #666666;
      padding: 0.4rem 0 0 0.5rem;
    }

    .close {
      width: 1.88rem;
      height: 1.88rem;

      > img {
        width: 100%;
        height: 100%;
      }
    }
  }

  .body {
    .tips {
      padding-top: 3.13rem;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;

      img {
        width: 4.56rem;
        height: 4.56rem;
        padding-right: 2.13rem;
      }

      .success_text {
        font-size: 1.5rem;
        color: #666;
        padding-bottom: 0.5rem;
      }

      .success_other {
        font-size: 0.88rem;
        color: #666;
        cursor: pointer;

        &:hover {
          text-decoration: underline;
        }
      }
    }
  }

  .footer {
    display: flex;
    justify-content: center;

    .btn {
      width: 11.75rem;
      height: 2.69rem;
      background: rgba(240, 64, 111, 1);
      color: #fff;
      text-align: center;
      line-height: 2.69rem;
      font-size: 1.13rem;
    }
  }
}
</style>
